/**
 * 
 */
package rachauto.presentation.common.utils;

import java.io.Serializable;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 * @author user
 *
 */
@SuppressWarnings("serial")
@ManagedBean(name = "templateHandler")
@SessionScoped	
public class NavigationLogicHandler implements Serializable {
	
	public static final String DEFAULT_TARGT = "/views/candidat/rechercher_candidat.xhtml";
	private String contentTarget;
	
	public static void clearSession(){
		FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
	}
	
	public static void traiterException(Exception e){
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR,"Erreur...", "Echec de traitement : "+e.getMessage()));
	}

	/**
	 * @return the contentTarget
	 */
	public String getContentTarget() {
		if(this.contentTarget == null){
			return DEFAULT_TARGT;
		}
		return contentTarget;
	}

	
	/**
	 * @param contentTarget the contentTarget to set
	 */
	public void setContentTarget(String contentTarget) {
		this.contentTarget = contentTarget;
	}

}
